<?php // debug($abiturients); ?>
<h2><?php __('Поиск по списоку абитуриентов');?></h2>
<table cellpadding="0" cellspacing="0" class='art-article'>
<?php
if ($abiturients){
	echo '
		<tr>
			<th><b>ID</b></th>
			<th><b>ФИО</b></th>
			<th><b>Серия</b></th>
			<th><b>Номер</b></th>
			<th><b>Действия</b></th>
		</tr>
	';
foreach ($abiturients as $abiturient):

?>
	<tr>
		<td>
			<?php echo $abiturient['Abiturient']['id']; ?>
		</td>
		<td>
			<?php echo $abiturient['Abiturient']['lastname']; ?> 
			<?php echo $abiturient['Abiturient']['firstname']; ?> 
			<?php echo $abiturient['Abiturient']['surname']; ?> 
		</td>
		<td>
			<?php echo $abiturient['Abiturient']['passport_ser']; ?>
		</td>
		<td>
			<?php echo $abiturient['Abiturient']['passport_num']; ?>
		</td>
		<td class="actions">
			<?php 
				if (!$abiturient['Abiturient']['prepared'] && !$abiturient['Abiturient']['approved'] && !$abiturient['Abiturient']['enrolled'] && !$abiturient['Abiturient']['canceled']) {
					echo $html->link(__('Оформить', true), array('action' => 'prepare', $abiturient['Abiturient']['id']));
				} else if ($abiturient['Abiturient']['prepared'] && !$abiturient['Abiturient']['approved'] && !$abiturient['Abiturient']['enrolled'] && !$abiturient['Abiturient']['canceled']) {
					echo $html->link(__('Учесть', true), array('action' => 'approve', $abiturient['Abiturient']['id'])); 
				} else if ($abiturient['Abiturient']['prepared'] && $abiturient['Abiturient']['approved'] && !$abiturient['Abiturient']['enrolled'] && !$abiturient['Abiturient']['canceled']) {
					echo $html->link(__('Изменить', true), array('action' => 'approvedchange', $abiturient['Abiturient']['id']));
				} else if ($abiturient['Abiturient']['prepared'] && $abiturient['Abiturient']['approved'] && $abiturient['Abiturient']['enrolled'] && !$abiturient['Abiturient']['canceled']) {
					echo '<b>Зачислен</b>' ;
				} 
				else if ($abiturient['Abiturient']['canceled']) {
					echo '<b>Забрал документы</b>';
				}
				 
			?>
		</td>
	</tr>
<?php endforeach; 
}
else {
	echo '<tr><td>';
	echo '<font color=red>Совпадений не найдено</font>';
	echo '</td></tr>';
}
?>
</table>